package com.nanhai.buddhist.college.module.collegebase.dal.mysql.studentroll;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.studentroll.vo.StudentRollExportReqVO;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.studentroll.vo.StudentRollPageReqVO;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.classes.ClassesDO;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.colleges.CollegesDO;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.departments.DepartmentsDO;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.professions.ProfessionsDO;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.studentroll.StudentRollDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.studentroll.vo.*;

/**
 * 学员信息 Mapper
 *
 * @author AKai
 */
@Mapper
public interface StudentRollMapper extends BaseMapperX<StudentRollDO> {

    default PageResult<StudentRollDO> selectPage(StudentRollPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentRollDO>()
                .likeIfPresent(StudentRollDO::getStudentName, reqVO.getStudentName())
                .likeIfPresent(StudentRollDO::getLegalName, reqVO.getLegalName())
                .eqIfPresent(StudentRollDO::getStudentSex, reqVO.getStudentSex())
                .eqIfPresent(StudentRollDO::getMonastical, reqVO.getMonastical())
                .eqIfPresent(StudentRollDO::getStudentNumber, reqVO.getStudentNumber())
                .eqIfPresent(StudentRollDO::getCollegesId, reqVO.getCollegesId())
                .eqIfPresent(StudentRollDO::getProfessionsId, reqVO.getProfessionsId())
                .eqIfPresent(StudentRollDO::getDepartmentsId, reqVO.getDepartmentsId())
                .eqIfPresent(StudentRollDO::getClassesId, reqVO.getClassesId())
                .orderByDesc(StudentRollDO::getCreateTime));
    }

    default List<StudentRollDO> selectList(StudentRollExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StudentRollDO>()
                .likeIfPresent(StudentRollDO::getStudentName, reqVO.getStudentName())
                .likeIfPresent(StudentRollDO::getLegalName, reqVO.getLegalName())
                .eqIfPresent(StudentRollDO::getStudentSex, reqVO.getStudentSex())
                .eqIfPresent(StudentRollDO::getMonastical, reqVO.getMonastical())
                .eqIfPresent(StudentRollDO::getStudentNumber, reqVO.getStudentNumber())
                .eqIfPresent(StudentRollDO::getCollegesId, reqVO.getCollegesId())
                .eqIfPresent(StudentRollDO::getProfessionsId, reqVO.getProfessionsId())
                .eqIfPresent(StudentRollDO::getClassesId, reqVO.getClassesId())
                .eqIfPresent(StudentRollDO::getDepartmentsId, reqVO.getDepartmentsId())
                .orderByDesc(StudentRollDO::getCreateTime));
    }



}
